<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String baseInfoJson= (String)request.getAttribute("baseInfoJson");
String hospitalVisitJson= (String)request.getAttribute("hospitalVisitJson");
%>
<link rel="stylesheet" href="${basePath}/assets/bootstrap/css/bootstrap.css"/>    
<link rel="stylesheet" href="${basePath}/assets/css/medical_record/home_page.css"/>
<link rel="stylesheet" href="${basePath}/assets/css/basic.css"/>
<link rel="stylesheet" href="${basePath}/assets/jquery-ui/jquery-ui.css"/>
<script type="text/javascript" src="${basePath}/assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/assets/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="${basePath}/assets/js/medical_record/home_page.js"></script>
<script type="text/javascript" src="${basePath}/assets/js/medical_record/edit_basic_info.js"></script>
<script type="text/javascript" src="${basePath}/assets/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_defined.css" rel="stylesheet" type="text/css">


<form action="${basePath}/medical_record/edit_home_page_basic"
	method="post" id="basicDataForm" style="height:auto">
<input type="hidden" id="basePath" value="${basePath }">
<input type="hidden" name="visitGuid" value="${visitGuid }">
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tbody>
	<tr>
		<!-- <td colspan="6"><input type="submit" value="保存" class="btn"></td> -->
		<td colspan="6"><a class="btn" id="saveBaseBtn" onclick="homePageBasicDataSave()">保存</a>
				</td>
			</tr>
			<tr>
				<td class="tdLabel_7 redColor">病案号*</td>
				<td class="tdLabel_8">
					<input type="text" name="onlyId" value="${hospitalVisit.onlyId }" id="onlyId" title='' />
				</td>

				<td class="tdLabel_7 redColor">ID号*</td>
				<td class="tdLabel_8">
					<input type="text" name="mrId" value="${hospitalVisit.mrId }" id="mrId" />
				</td>
				<td class="tdLabel_7 redColor">住院次数*</td>
				<td class="tdLabel_8">
					<input type="text" name="visitNumber" id="visitNumber"
								value="${hospitalVisit.visitNumber }" />
				</td>
				<!-- <td class="tdLabel_7 redColor">医院名称</td> -->
				<!-- <td class="tdLabel_8">
					<input type="text" name="hospitalName" readonly="readonly"
								value="解放军第三〇五医院" title='' />
					<input type="hidden" name="hospitalCode" readonly="readonly"
								value="解放军第三〇五医院" title='' />
				</td> -->
			</tr>
			<!-- <tr> -->
				<%-- <td class="tdLabel_7">健康卡号</td>
				<td class="tdLabel_8">
					<input type="text" name="medicalInsuranceNumber" value="${hospitalVisit.medicalInsuranceNumber}" id="medicalInsuranceNumber"/>
				</td> --%>

			<!-- 	<td class="tdLabel_7 redColor">付费方式*</td>
				<td class="tdLabel_8">
					<input type="text" name="payTypeId" id="payTypeId" value="" title='' />
					<select name="medicalPayTypeCode" id="medicalPayTypeCode" title=''>
						
					</select>
					<input type="hidden" name="medicalPayTypeName"  value=""/>
				</td> -->
				<%-- <td class="tdLabel_7 redColor">住院次数*</td>
				<td class="tdLabel_8">
					<input type="text" name="visitNumber" id="visitNumber"
								value="${hospitalVisit.visitNumber }" title='' />
				</td> --%>
			<!-- </tr> -->
			<tr>
				<td class="tdLabel_7 redColor">姓名*</td>
				<td class="tdLabel_8">
					<input type="text" name="patientName" value="${hospitalVisit.patientName}" id="patientName" title='' />
				</td>

				<td class="tdLabel_7">证件类型</td>
				<td class="tdLabel_8">
					<select name="idDocumentTypeCode" id="idDocumentTypeCode" title=''>
						
					</select>
					<input type="hidden" name="idDocumentTypeName"  value=""/>
				</td>
				<td class="tdLabel_7">证件号</td>
				<td class="tdLabel_8">
					<input type="text" name="idNumber" id="idNumber"
								value="${hospitalVisit.idNumber }"/>
				</td>
			</tr>
			<tr>
				<td class="tdLabel_7 redColor">性别*</td>
				<td class="tdLabel_8">
					<select name="sexCode" id="sexCode" title=''>
						
					</select>
					<input type="hidden" name="sexName"  value=""/>
				</td>

				<td class="tdLabel_7">出生日期</td>
				
									
					<td class="tdLabel_8"><input type="text"
						onFocus="WdatePicker()" name="birthday" value="${hospitalVisit.birthday }" />
					</td>
				<td class="tdLabel_7">年龄</td>
				<td class="tdLabel_8">
					<input type="text" rel="popover"  name="age" id="age" value="${hospitalVisit.age }"/>
				</td>
			</tr>
			<tr>
				<td class="tdLabel_7 redColor">国籍*</td>
				<td class="tdLabel_8">
					<select name="nationalityCode" id="nationalityCode" title=''>
						
					</select>
					<input type="hidden" name="nationalityName"  value=""/>
				</td>

				<td class="tdLabel_7">籍贯</td>
				<td class="tdLabel_8">
					<input type="text" name="nativePlace" id="nativePlace" value="${hospitalVisit.nativePlace}"/>
				</td>
				<td class="tdLabel_7">民族</td>
				<td class="tdLabel_8">
					<select name="nationCode" id="nationCode" title=''>
						
					</select>
					<input type="hidden" name="nationName"  value=""/>
				</td>
			</tr>
			
			<tr>
				<td class="tdLabel_7">人员类别</td>
				<td class="tdLabel_8">
					<select name="personnelCategoryCode" id="personnelCategorySelect">
						
					</select>
					<input type="hidden" name="personnelCategoryName"  value=""/>
				</td>

				<td class="tdLabel_7">隶属大单位</td>
				<td class="tdLabel_8">
					<select name="majorUnitCode" id="majorUnitSelect">
						
					</select>
					<input type="hidden" name="majorUnitName"  value=""/>
				</td>
				<td class="tdLabel_7">勤务</td>
				<td class="tdLabel_8">
					<select name="troopServiceCode" id="troopServiceSelect">
						
					</select>
					<input type="hidden" name="troopServiceName"  value=""/>
				</td>
			</tr>
			
			<tr>
				<td class="tdLabel_7">医疗体系</td>
				<td class="tdLabel_8">
					<select name="medicalSystemCode" id="medicalSystemSelect">
						
					</select>
					<input type="hidden" name="medicalSystemName"  value=""/>
				</td>

				<td class="tdLabel_7">身份</td>
				<td class="tdLabel_8">
					<select name="idTypeCode" id="idTypeSelect">
						
					</select>
					<input type="hidden" name="idTypeName"  value=""/>
				</td>
				<td class="tdLabel_7">费别</td>
				<td class="tdLabel_8">
					<select name="costTypeCode" id="costTypeSelect">
						
					</select>
					<input type="hidden" name="costTypeName"  value=""/>
				</td>
			</tr>
			
			<tr>
				<td class="tdLabel_7">在职状况</td>
				<td class="tdLabel_8">
					<select name="jobStateCode" id="jobStateSelect">
						
					</select>
					<input type="hidden" name="jobStateName"  value=""/>
				</td>
				
				<td class="tdLabel_7 redColor">付费方式*</td>
				<td class="tdLabel_8">
					<!-- <input type="text" name="payTypeId" id="payTypeId" value="" title='' /> -->
					<select name="medicalPayTypeCode" id="medicalPayTypeCode" title=''>
						
					</select>
					<input type="hidden" name="medicalPayTypeName"  value=""/>
				</td>

				<td class="tdLabel_7">军事训练伤</td>
				<td class="tdLabel_8">
					<select name="militaryTrainingInjuryCode" id="militaryTrainingInjurySelect">
						
					</select>
					<input type="hidden" name="militaryTrainingInjuryName"  value=""/>
				</td>
				
			</tr>
			
			<tr>
				<td class="tdLabel_7">出生地</td>
				<td class="tdLabel_8">
					<input type="text" name="birthAddress" value="${hospitalVisit.birthAddress }" id="birthAddressCode"/>
				</td>

				<td class="tdLabel_7 redColor">职业*</td>
				<td class="tdLabel_8">
					<select name="professionCode" id="professionCode" title=''>
						
					</select>
					<input type="hidden" name="professionName"  value=""/>
				</td>
				<td class="tdLabel_7 redColor">婚姻*</td>
				<td class="tdLabel_8">
					<select name="marriageCode" id="marriageCode" title=''>
						
					</select>
					<input type="hidden" name="marriageName"  value=""/>
				</td>
			</tr>
			<tr>
				<td class="tdLabel_7" rowspan="2">现/永住地</td>
				<td class="tdLabel_8" colspan="5">地址 
					<input type="text" name="permanentAddress" style="width: 500px" value="${hospitalVisit.permanentAddress}">
				</td>
			</tr>
			<tr>
				<td class="tdLabel_8">电话 <input type="text"
					name="permanentAddressPhone" style="width:170px" value="${hospitalVisit.permanentAddressPhone}">
				</td>
				<td class="tdLabel_7">移动电话</td>
				<td class="tdLabel_8"><input type="text" name="permanentAddressMobilePhone"
					style="width:150px" value="${hospitalVisit.permanentAddressMobilePhone}">
				</td>
				<td class="tdLabel_7">邮编</td>
				<td class="tdLabel_8" ><input type="text"
					name="permanentAddressPostCode" style="width:150px"
					value="${hospitalVisit.permanentAddressPostCode}">
				</td>
			</tr>
			
			<tr>
				<td align="left" class="tdLabel_7" rowspan="2">工作单位</td>
				<td class="tdLabel_8" colspan="3">地址： <input
					type="text" name="workUnitAddress" style="width: 500px"
					value="${hospitalVisit.workUnitAddress }">
				</td>
				
				<td align="left" class="tdLabel_7">电话</td>
				<td class="tdLabel_8"><input type="text"
					name="workUnitPhone" value="${hospitalVisit.workUnitPhone }">
				</td>
			</tr>
			<tr>
				<td class="tdLabel_8" colspan="3">单位名：<input type="text" style="width: 490px"
					name="workUnitName" value="${hospitalVisit.workUnitName }">
				</td>
				<td align="left" class="tdLabel_7">邮编</td>
				<td class="tdLabel_8"><input type="text"
					name="workUnitPostCode" value="${hospitalVisit.workUnitPostCode}">
				</td>
			</tr>
			<tr>
				<td align="left" class="tdLabel_7" rowspan="2">联系人</td>
				<td align="left" class="tdLabel_8">姓名 <input type="text"
					name="linkManName" style="width: 150px"
					value="${hospitalVisit.linkManName}">
				</td>
				<td class="tdLabel_8" align="left" colspan="4">地址： <input
					type="text" name="linkManAddress" style="width: 500px"
					value="${hospitalVisit.linkManAddress}">
				</td>

			</tr>
			<tr>
				<td align="left" class="tdLabel_8" colspan="3">与病人关系&emsp;
					<select style="width: 40%;" name="linkManRelativeRelationCode" id="linkManRelativeRelationCode">
						
					</select>
					<input type="hidden" name="linkManRelativeRelationName"  value=""/>
				</td>
				<td class="tdLabel_7">电话</td>
				<td class="tdLabel_8"><input type="text"
					name="linkManPhone" style="width: 150px";
					value="${hospitalVisit.linkManPhone}">
				</td>
			</tr>

			<tr>
				<td class="tdLabel_7">接诊日期</td>
				<td class="tdLabel_8"><fmt:formatDate
						var="clinicalReceptionDate"
						value=""
						pattern="yyyy-MM-dd" /> <input type="text"
					onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="clinicalReceptionDateTime"
					value="${hospitalVisit.clinicalReceptionDateTime }" /></td>

				<td class="tdLabel_7">门诊医生</td>
				<td class="tdLabel_8"><input type="text"
					name="outpatientOfDoctorName"
					class="medical_worker_search_input"
					value="${hospitalVisit.outpatientOfDoctorName }">
					<input type="hidden" name="outpatientOfDoctorCode" value="${hospitalVisit.outpatientOfDoctorCode }">
				</td>

				<td class="tdLabel_7">经办人</td>
				<td class="tdLabel_8"><input type="text"
					name="responsiblePersonName"
					class="medical_worker_search_input"
					value="${hospitalVisit.responsiblePersonName }">
					<input type="hidden" name="responsiblePersonCode" value="${hospitalVisit.responsiblePersonCode }">
				</td>
			</tr>
			<%-- <tr>
				<td class="tdLabel_7 redColor">入院途径*</td>
				<td class="tdLabel_8">
					<select name="inHospitalTypeCode" id="inHospitalTypeCode" title=''>
						
					</select>
					<input type="hidden" name="inHospitalTypeName"  value=""/>
				</td>
				<td class="tdLabel_7">转入机构</td>
				<td class="tdLabel_8" colspan="3">
					<input type="text" name="shiftToUnitName" value="${hospitalVisit.shiftToUnitName}">
				</td>
			</tr> --%>
			<tr>
			    <td class="tdLabel_7 redColor">入院途径*</td>
				<td class="tdLabel_8">
					<select name="inHospitalTypeCode" id="inHospitalTypeCode" title=''>
						
					</select>
					<input type="hidden" name="inHospitalTypeName"  value=""/>
				</td>
				<td class="tdLabel_7">入院状况</td>
				<td class="tdLabel_8">
				<select name="inHospitalStateCode" id="inHospitalStateCode" title=''>
						
					</select>
					<input type="hidden" name="inHospitalStateName"  value=""/>
				</td>
				
				<%-- <td class="tdLabel_7">颅脑损伤昏迷时间</td>
				<td class="tdLabel_8">
				 <input type="text" name="craniocerebralInjuryAndComaDateTime"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
					value="${hospitalVisit.craniocerebralInjuryAndComaDateTime}"></td> --%>
				<td class="tdLabel_7">诊断确诊时间</td>
				<td class="tdLabel_8">
				 <input type="text" name="diagConfirmedDateTime"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
					value="${hospitalVisit.diagConfirmedDateTime}" style="width: 150px">
				</td>
			</tr>
			
			<tr>
				<td class="tdLabel_7 redColor">入院科室*</td>
				<td class="tdLabel_8">
					<select name="inDeptCode" id="inDeptCode" title=''>
						
					</select>
					<input type="hidden" name="inDeptName"  value=""/>
				</td>
				<td class="tdLabel_7 redColor">入院时间*</td>
				<td class="tdLabel_8">
					<input type="text" name="inHospitalDateTime" id="inHospitalDateTime"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
					value="${hospitalVisit.inHospitalDateTime}" title=''></td>

			<%-- 	<td class="tdLabel_7">诊疗科目</td>
				<td class="tdLabel_8">
				<input type="text" name="diagSubjectName"
					value="${hospitalVisit.diagSubjectName}">
				</td> --%>
				<tr>
				<td class="tdLabel_7 redColor">出院科室*</td>
				<td class="tdLabel_8">
					<select name="outDeptCode" id="outDeptCode" title=''>
						
					</select>
					<input type="hidden" name="outDeptName"  value=""/>
				</td>
				<td class="tdLabel_7 redColor">出院时间*</td>
				<td class="tdLabel_8">
					<input type="text" name="outHospitalDateTime" id="outHospitalDateTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
					value="${hospitalVisit.outHospitalDateTime}" title=''></td>
			</tr>

			<tr>
				<td class="tdLabel_7 redColor">离院方式*</td>
				<td class="tdLabel_8">
					<select name="outHospitalTypeCode" id="outHospitalTypeCode" title=''>
						
					</select>
					<input type="hidden" name="outHospitalTypeName"  value=""/>
				</td>
				<%-- <td class="tdLabel_7">拟接收机构</td>
				<td class="tdLabel_8" colspan="3">
				<input type="text" name="receiveUnitName" value="${hospitalVisit.receiveUnitName }">
				</td> --%>
				<td class="tdLabel_7">根本死亡原因</td>
				<td class="tdLabel_8">
				<input type="text" name="dealthReasonName"
					
					value="" title=''/>
					<!-- <select name="dealthReasonCode" id="dealthReasonCode">
						
					</select>
					<input type="hidden" name="dealthReasonName"  value=""/> -->
				</td>
				<td class="tdLabel_7">尸检</td>
				<td class="tdLabel_8" colspan="3">
					<input type="radio" class="radio_cl" name="autopsyCode" value="1">
                        			 是
                    <input type="radio" class="radio_cl" name="autopsyCode" value="0">
                        			 否
                    <input type="hidden" name="autopsyName" value="">
              	</td>
			</tr>
			<%-- <tr>
				<td class="tdLabel_7">再住院计划</td>
				<td class="tdLabel_8">
					<select style="width: 120px" name="rehospitalAimCode" id="rehospitalAimCode">
						
					</select>
					<input type="hidden" name="rehospitalAimName"  value=""/> 间隔 
					<input type="text" style="width:30px"
					name="rehospitalIntervalDayNumber"
					value="${hospitalVisit.rehospitalIntervalDayNumber }"> 天</td>
				<td class="tdLabel_7">根本死亡原因</td>
				<td class="tdLabel_8">
					<select name="dealthReasonCode" id="dealthReasonCode">
						
					</select>
					<input type="hidden" name="dealthReasonName"  value=""/>
				</td>
				<td class="tdLabel_7">尸检</td>
				<td class="tdLabel_8" colspan="3">
					<input type="checkbox" name="autopsyCode" value="1">
                        			 是
                    <input type="checkbox" name="autopsyCode" value="0">
                        			 否
                    <input type="hidden" name="autopsyName" value="">
              	</td>
			</tr> --%>
		</tbody>
	</table>
</form>
<script>
	$(function(){
		var baseInfoJson= <%=baseInfoJson%>;
		var hospitalVisitJson = <%=hospitalVisitJson%>
		initPage(baseInfoJson,hospitalVisitJson);
		validateData();
	});
	//保存
	function homePageBasicDataSave(){
		//病案号
		var onlyId=$("#onlyId").val();
		if(!onlyId){
			layer.alert("病案号不能为空!",{icon:7});
    		return;
		}
		//识别码
		var mrId=$("#mrId").val();
		if(!mrId){
			layer.alert("识别码不能为空!",{icon:7});
    		return;
		}
		//住院次数
		var visitNumber=$("#visitNumber").val();
		if(!visitNumber){
			layer.alert("住院次数不能为空!",{icon:7});
    		return;
		}
		//姓名
		var patientName=$("#patientName").val();
		if(!patientName){
			layer.alert("姓名不能为空!",{icon:7});
    		return;
		}
		//性别
		var sexCode=$("#sexCode").val();
		if(!sexCode){
			layer.alert("性别不能为空!",{icon:7});
    		return;
		}
		//国籍
		var nationalityCode=$("#nationalityCode").val();
		if(!nationalityCode){
			layer.alert("国籍不能为空!",{icon:7});
    		return;
		}
		//付费方式
		var medicalPayTypeCode=$("#medicalPayTypeCode").val();
		if(!medicalPayTypeCode){
			layer.alert("付费方式不能为空!",{icon:7});
    		return;
		}
		//职业
		var professionCode=$("#professionCode").val();
		if(!professionCode){
			layer.alert("职业不能为空!",{icon:7});
    		return;
		}
		//婚姻
		var marriageCode=$("#marriageCode").val();
		if(!marriageCode){
			layer.alert("婚姻不能为空!",{icon:7});
    		return;
		}
		//入院途径
		var inHospitalTypeCode=$("#inHospitalTypeCode").val();
		if(!inHospitalTypeCode){
			layer.alert("入院途径不能为空!",{icon:7});
    		return;
		}
		//入院科室
		var inDeptCode=$("#inDeptCode").val();
		if(!inDeptCode){
			layer.alert("入院科室不能为空!",{icon:7});
    		return;
		}
		//入院时间
		var inHospitalDateTime=$("#inHospitalDateTime").val();
		if(!inHospitalDateTime){
			layer.alert("入院时间不能为空!",{icon:7});
    		return;
		}
		//出院科室
		var outDeptCode=$("#outDeptCode").val();
		if(!outDeptCode){
			layer.alert("出院科室不能为空!",{icon:7});
    		return;
		}
		//出院时间
		var outHospitalDateTime=$("#outHospitalDateTime").val();
		
		if(!outHospitalDateTime){
			layer.alert("出院时间不能为空!",{icon:7});
    		return;
		}
		//离院方式
		var outHospitalTypeCode=$("#outHospitalTypeCode").val;
		if(!outHospitalTypeCode){
			layer.alert("离院方式不能为空!",{icon:7});
    		return;
		}
		$("#basicDataForm").submit();
	}
</script>